package com.ysd.servlet;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import java.io.IOException;

/**
 * 1.创建一个类，继承HttpServlet
 * 2.重写service方法
 * 3.配置
 */
//新版本的配置方式，不需要配置xml文件
//@WebServlet(urlPatterns = "/first")
public class ServletDemo extends HttpServlet {
    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        res.getWriter().write("hello,servlet");
    }
}